$(function () {
	$("#submit").click(function(){
		var userCode = $.trim($("#userCode").val());
		var password = $.trim($("#password").val());
		if($("#userCode").val() == null || $("#userCode").val() == ""){
			alertify.warning("帐号不能为空！");
            return;
		}
		if($("#password").val() == null || $("#password").val() == ""){
			alertify.warning("密码不能为空！");
            return;
		}
		var data = {userCode:userCode,password:password,status:'1'};
		$.ajax({
			type: 'POST',
			url: '/sys/login.do',
			data: data,
			dataType: 'json',
			success: function(res) {
				if(res.code == "103"){
					alertify.success("登录成功！");
					window.location.href = "/sys/getMainPage.do";
				}else if(res.code == "104"){
					alertify.warning("登录失败！");
				}
	         },
			error: function(res) {
				alertify.error("数据传输错误！");
			}
		});
	});
});